<!-- 2023年十月活动团队邀请赛奖品弹窗 -->
<!-- XXX 考虑改为使用通用的奖品弹窗，然后将该文件删除 -->
<template>
  <!-- 提示弹窗 -->
  <uni-popup ref="popup">
    <div class="content">
      <image
        class="title"
        src="https://ustatic.hudongmiao.com/joymew-host-contest/202310-activity/team-invitation-competition-rewards.png"
        mode="aspectFit"
      />
      <div class="reward-list">
        <div
          v-for="(reward,index) in REWARD_LIST"
          :key="index"
          class="reward-item"
        >
          <image
            class="img"
            :src="reward.img"
            mode="aspectFill"
          />
          <div class="text">
            {{ reward.text }}
          </div>
        </div>
      </div>
      <div
        class="i-know"
        @click="close"
      >
        我知道了
      </div>
    </div>
  </uni-popup>
</template>

<script setup lang="ts">

/** 奖励列表 */
const REWARD_LIST = [
  {
    img: 'https://ustatic.hudongmiao.com/joymew-host-contest/202310-activity/team-invitation-competition-reward-1.png',
    text: '第一名',
  },
  {
    img: 'https://ustatic.hudongmiao.com/joymew-host-contest/202310-activity/team-invitation-competition-reward-2.png',
    text: '第二名',
  },
  {
    img: 'https://ustatic.hudongmiao.com/joymew-host-contest/202310-activity/team-invitation-competition-reward-3.png',
    text: '第三名',
  },
  {
    img: 'https://ustatic.hudongmiao.com/joymew-host-contest/202310-activity/team-invitation-competition-reward-4.png',
    text: '第四名',
  },
  {
    img: 'https://ustatic.hudongmiao.com/joymew-host-contest/202310-activity/team-invitation-competition-reward-5.png',
    text: '第五名',
  },
  {
    img: 'https://ustatic.hudongmiao.com/joymew-host-contest/202310-activity/team-invitation-competition-reward-6.png',
    text: '第6~10名',
  },
  {
    img: 'https://ustatic.hudongmiao.com/joymew-host-contest/202310-activity/team-invitation-competition-reward-7.png',
    text: '第11~20名',
  },
  {
    img: 'https://ustatic.hudongmiao.com/joymew-host-contest/202310-activity/team-invitation-competition-reward-8.png',
    text: '第21~50名',
  },
];

/** 当前组件实例 */
const currentInstance = getCurrentInstance();
/** 弹窗打开 */
const open = () => {
  const popup = currentInstance?.refs.popup as UniHelper.UniPopupInstance;
  if (popup.open) {
    popup.open();
  }
};

/** 弹窗关闭 */
const close = () => {
  const popup = currentInstance?.refs.popup as UniHelper.UniPopupInstance;
  if (popup.close) {
    popup.close();
  }
};

defineExpose({
  open,
  close,
});

</script>

<style scoped lang="scss">
.content {
  width: 92.2667vw;

  background-color: #fff;
  border-radius: 16px;

  padding: 22px 16px 24px;
  display: grid;
  grid-template:
    'title' max-content
    'reward-list' min-content
    'i-know' max-content
    / 1fr;
  row-gap: 15px;

  .title{
    grid-area: title;
    margin-bottom: 10px;

    width: 100%;
    height: 21px;
  }

  .reward-list {
    width: 100%;

    display: grid;
    grid-template-rows: repeat(3, 1fr);
    grid-template-columns: repeat(3, 1fr);
    row-gap: 12px;

    .reward-item{
      display: flex;
      flex-direction: column;
      row-gap: 9px;
      align-items: center;
      justify-content: center;

      .img{
        width: 22.1333vw;
        height: 22.1333vw;

        border-radius: 9px;
      }

      .text{
        font-size: 15px;
        color: #333;
      }
    }
  }

  .i-know{
    grid-area: i-know;
    justify-self: center;

    width: 64vw;
    height: 9.6vw;

    background: linear-gradient(98deg,#ff69b7, #8d70ff 100%);
    border-radius: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 15px;
    color: #fff;
  }
}
</style>

<!-- 规则内容样式 -->
<style lang="scss">
.rich-h1 {
  font-size: 17px;
  font-weight: bold;
  color: #333;
}

.rich-p,.rich-ol {
  margin-top: 5px;

  padding: 0 0 0 20px;

  font-size: 15px;
  line-height: 28px;
  color: #333;

  .rich-li {
    margin: 5px 0;
  }
}

.rich-table {
  margin-top: 5px;

  border-collapse: collapse;

  border: 1px solid #333;

  font-size: 13px;
  color: #333;

  .rich-tr {
    border: 1px solid #333;

    .rich-td {
      border: 1px solid #333;

      padding: 5px;
    }
  }
}
</style>
